<?php

namespace App\Admin\Extensions;

use Encore\Admin\Admin;
use Encore\Admin\Grid\Tools\AbstractTool;

class ResetFaker extends AbstractTool
{

    protected function script()
    {
        return <<<EOF
$('#reset-faker').click(function() {
var reset_status = confirm('确认要重置数据吗？');
if (reset_status == true) {
    $.post("/admin/reset_faker",function(res){
        console.log(res);
    })
}

})
EOF;
    }

    public function render()
    {
        Admin::script($this->script());

        return view('admin.reset_faker');
    }
}